#include "widget.h"
#include <QtSingleApplication>
#include "boot/e_boot.h"
#include "m_fhs.h"

bool bootCheck()
{
    QSettings reg(REG_ULOGIN,QSettings::NativeFormat);
    auto account=reg.value("user_account").toString();
    if(account.isEmpty())
    {
        QMessageBox::warning(0,"认证异常","不存在本地账号信息，请先登录ULogin");
        return false;
    }

    auto roles=reg.value("user_roles").toString();
    if(roles.contains("1") || roles.contains("18"))
        return true;
    else
    {
        QMessageBox::warning(0,"权限异常","本程序只限仓储人员使用！");
        return false;
    }
}

int main(int argc, char *argv[])
{
    SP_Single_Boot

            if(!bootCheck())
            return -1;

    Widget w;
    a.setActivationWindow(&w);
    w.show();
    return a.exec();
}
